﻿@model Model.AppUserList
@{
    ViewBag.Title = "货位信息管理";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@section JQscriptSection{
    <script src="../../Scripts/viewsScript/Location/LocationC.js" type="text/javascript"></script>
    <script src="../../Scripts/viewsScript/Common/MyDialog.js" type="text/javascript"></script>
    <script src="../../Scripts/jqueryeasyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript">

            function checklocationcode() {
                var code = $.trim($("#txtLocationCode").attr("value"));
                var hiddencode = $.trim($("#hiddenLocationCode").attr("value"));
                var LOCATIONID = $.trim($("#hiddenLOCATIONID").attr("value"));
                if (LOCATIONID == "" || code != hiddencode) {
                    $('#location').form('submit', {
                        url: '@Url.Content("~/Location/checkLocation")',
                        success: function (data) {
                            eval('data=' + data);
                            if (data.success) {
                                @*location.href = '@Url.Action("AddUser", "User")';*@
                            } else {
                                $.messager.alert('错误', data.msg, 'error');
                                $("#txtLocationCode").val("").focus();
                                //alert("保存失败！请检查");
                            }
                        }
                    });
                }
            }

            function ExporterExcel() {
                var form = $('#query');
                var rows = $(".pagination-page-list option:selected").text();
                var page = $("input[size='2']").val();
                form.form('submit', {
                    url: '@Url.Content("~/Location/ExportExcel")' + '?page=' + page + '&rows=' + rows,
                    success: function (data) {
                        eval('data=' + data);
                        if (data.success) {
                            InitGrid();
                        } else {
                            $.messager.alert('错误', data.msg, 'error');
                        }
                        //$("#txtOrdSubjectCode").val("");
                    }
                });
            }
            function Import() {
                var form = $('#import');
                form.form('submit', {
                    url: '/Location/ImportLocation',
                    success: function (data) {
                        eval('data=' + data);
                        if (data.success) {
                            InitGrid();
                        } else {
                            $.messager.alert('错误', data.msg, 'error');
                        }
                    }
                });
            };
    </script>
}
<body style="background-color: ButtonFace; font-size: 17px" @*onload="InitGrid();"*@>

    <div class="easyui-panel" title="查询条件" style="height: 130px; padding: 5px; background: #fafafa;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>货位编号:
                    </td>
                    <td>
                        <input id="txtSLOCATIONCODE" name="txtSLOCATIONCODE" style="width: 154px" />
                    </td>
                    <td>货位类型:
                    </td>
                    <td>
                        <select id="SLocationType" class="easyui-combobox" name="SLocationType" style="width: 154px;">
                            <option value="">--全部--</option>
                            <option value="逻辑货位">逻辑货位</option>
                            <option value="存储货位">存储货位</option>
                        </select>
                    </td>
                    <td>仓库:
                    </td>
                    <td>
                        <select id="SWAREHOUSEID" class="easyui-combogrid" name="SWAREHOUSEID" style="width: 370px;"
                            data-options="
                        idField:'WAREHOUSEID',
                        textField:'WAREHOUSENAME',
                        url:'@Url.Content("/Location/WarehouseList?IsSetAll=0")',
                        columns:[[
                            {field:'WAREHOUSECODE',title:'编码',width:60},
                            {field:'WAREHOUSENAME',title:'名称',width:100},
                            {field:'SHOPNAME',title:'店铺',width:188}
                        ]]
                    ">
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>区域:
                    </td>
                    <td>
                        <input id="txtSArea" name="txtSArea" style="width: 154px" />
                    </td>
                    <td>巷道:
                    </td>
                    <td>
                        <input id="txtSRoadWay" name="txtSRoadWay" style="width: 154px" />
                    </td>
                    <td>状态:
                    </td>
                    <td>
                        <select id="SSTATUS" class="easyui-combobox" name="SSTATUS" style="width: 154px;">
                            <option value="">--全部--</option>
                            <option value="0">失效</option>
                            <option value="1">生效</option>
                        </select>
                    </td>
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGrid()">查询</a>
                    </td>
                </tr>
            </table>
        </form>
        <form id="import" method="post" enctype="multipart/form-data">
            <table>
                <tr>
                    <td>
                        <input id="FileUpload" type="file" name="files" style="width: 250px; height: 24px; background: White"
                            class="easyui-validatebox" />
                        <a id="btnImport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-upload'" onclick="Import()">导入</a>
                    </td>
                    <td>
                        <a id="btnExecl" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onclick="ExporterExcel()">导出</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <div>
        <table id="tab_list">
        </table>
    </div>
    <div id="p1" class="easyui-dialog" style="width: 650px; height: 340px; padding: 10px 20px" closed="true" buttons="#dlg-buttons">
        <form id="location" method="post">
            <table>
                <tr>
                    <td>货位编码:
                    </td>
                    <td>
                        <input id="hiddenLOCATIONID" name="hiddenLOCATIONID" type="hidden" />
                        <input id="hiddenLocationCode" name="hiddenLocationCode" type="hidden" />
                        <input id="txtLocationCode" name="txtLocationCode" maxlength="20" style="width: 154px" onblur="checklocationcode()" />
                    </td>
                    <td>货位类型:
                    </td>
                    <td colspan="2">
                        <select id="LocationType" class="easyui-combobox" name="LocationType" style="width: 154px;">
                            <option value="逻辑货位">逻辑货位</option>
                            <option value="存储货位">存储货位</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>货架:
                    </td>
                    <td colspan="4">
                        <input id="txtGOODSRACK" name="txtGOODSRACK" maxlength="128" style="width: 520px" />
                    </td>
                </tr>
                <tr>
                    <td>层:
                    </td>
                    <td>
                        <input id="txtTier" name="txtTier" maxlength="30" style="width: 154px" />
                    </td>
                    <td>列:
                    </td>
                    <td colspan="2">
                        <input id="txtColumns" name="txtColumns" maxlength="30" style="width: 154px" />
                    </td>
                </tr>
                <tr>
                    <td>区域:
                    </td>
                    <td>
                        <input id="txtArea" name="txtArea" maxlength="20" style="width: 154px" />
                    </td>
                    <td>巷道:
                    </td>
                    <td colspan="2">
                        <input id="txtRoadWay" name="txtRoadWay" maxlength="20" style="width: 154px" />
                    </td>
                </tr>
                <tr>
                    <td>体积:
                    </td>
                    <td>
                        <input id="txtVolume" name="txtVolume" maxlength="20" style="width: 154px" />
                    </td>
                    <td>库位:
                    </td>
                    <td colspan="2">
                        <select id="CellNo" class="easyui-combogrid" name="CellNo" style="width: 154px;"
                            data-options="
                        idField:'CELLNO',
                        textField:'CELLNO',
                        url:'@Url.Content("/BaseData/CellNoList")',
                        columns:[[
                            {field:'CELLNO',title:'库位',width:120}
                        ]]
                    ">
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>备注:
                    </td>
                    <td colspan="4">
                        <input id="txtRemark" name="txtRemark" maxlength="255" style="width: 520px" />
                    </td>
                </tr>
                <tr>
                    @*<td>状态:
                    </td>
                    <td>
                        <select id="STATUS" class="easyui-combobox" name="STATUS" style="width: 154px;">
                            <option value="0">失效</option>
                            <option value="1">生效</option>
                        </select>
                    </td>*@
                    <td>仓库：</td>
                    <td colspan="2">
                        <select id="WAREHOUSEID" class="easyui-combogrid" name="WAREHOUSEID" style="width: 250px;"
                            data-options="
                        idField:'WAREHOUSEID',
                        textField:'WAREHOUSENAME',
                        url:'@Url.Content("/Location/WarehouseList?IsSetAll=1")',
                        columns:[[
                            {field:'WAREHOUSECODE',title:'编码',width:30},
                            {field:'WAREHOUSENAME',title:'名称',width:50},
                            {field:'SHOPNAME',title:'店铺',width:170}
                        ]]
                    ">
                        </select>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <a id="btnSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="save()">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>

</body>

